# makefile for the font stuff
#
# (c)2007 Scott Lawrence
#
# Copyright (C) 2007 by Scott Lawrence
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# 
#


TARGET := ami2bdf
TESTFONT := /Users/sdl/src/yorgle/extras/fonts/Amiga/Commodore/topaz/8
#TESTFONT := /Users/sdl/src/yorgle/extras/fonts/Amiga/Commodore/ruby/8
#TESTFONT := /Users/sdl/src/yorgle/extras/fonts/Amiga/Commodore/diamond/20
#TESTFONT := /Users/sdl/src/yorgle/extras/fonts/Amiga/Commodore/garnet/9


SRCS := \
	afdump.c \
	myfont.c \
	endian.c

OBJS := $(SRCS:%.c=%.o)


CC=gcc

################################################################################

# build targets
all: 	$(TARGET)

test:	all
	./$(TARGET) $(TESTFONT) Commodore topaz output.bdf
# -dbl
.PHONY: test

fd:
	mkfontdir
	xset +fp `pwd`
	xset fp rehash
	#xfd -fn -Commodore-topaz2_dbl-medium-R-normal--16--96-96-M-70-winsys-1



w:
	hexdump -C $(TESTFONT) | more


# build flags
CXXFLAGS := -g -Wall -pedantic-errors
CFLAGS := -g -Wall -pedantic-errors

# final link
$(TARGET): 	$(OBJS)
	@echo Linking $@
	@$(CC) -g -o $@ $(OBJS) $(LDFLAGS) $(LIBS)

# module build - c++
%.o:    %.cpp
	@echo Compiling $@
	@-$(MKDIR_CMD)
	@$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<


# module build - c
%.o:    %.c
	@echo Compiling $@
	@$(CC) $(CXXFLAGS) -c -o $@ $<


################################################################################

clean: 
	@echo Cleaning
	@-rm -rf $(OBJS)
	@-rm $(TARGET)
	@-rm -f *.dir
	@-rm -f *.bdf
.PHONY: clean

backup:
	tar -cvf ../fontSRCbackup.tar $(SRCS) *.pl *ake*
.PHONY: backup

gz:
	cp readme.txt UmlautLlamaFonts/
	tar -cvf UmlautLlamaFonts_0004.tar UmlautLlamaFonts
	gzip UmlautLlamaFonts_0004.tar

################################################################################
# dependancies

afdump.o: afdump.c
afdump.o: endian.o

endian.o: endian.c
